home *** CD-ROM | disk | FTP | other *** search
-
- QbPrt V 1.0
-
- Copyright 1989 (C) L.Weinman 121 Valdivia Cir. San Ramon, CA USA
- ____________________________________________________________________
-
- Legal stuff:
-
- This copyrighted program is licensed for non-commercial use without
- cost . No charge may be made by anyone other than the copyright
- holder for this program, except for a nominal fee for copying and
- distribution. It may not be included, or bundled, with any materials
- for which a charge is made. Commercial distribution, or use, may only
- be made with the agreement of the copyright holder.
-
- In other words, give it to others for free and don't use it for work,
- or profit, without obtaining a commercial license. (cheap)
-
- Any distribution of the program QbPrt must include this document.
- ____________________________________________________________________
-
-
-
- This program is intended to make QuickBasic (C) source code more
- readable by indenting the logical structures to make them more
- obvious. It will also produce an output suitable for printing.
-
- I wrote it because I was not satisfied with the programs that I had
- seen. If you are not satisfied with it, please let me know, and I
- will examine your complaints, and suggestions, and perhaps
- incorporate them in future editions. I won't know if you are unhappy
- if you don't tell me.
-
-
- If you are a non-commercial user, and like the program, then small
- gifts are always welcome.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Pg. 1
-
-
-
-
-
- I have tried to make the program self-explanatory.
-
- After starting the program, select either
-
- 1 = Pretty A QuickBasic Source File
- 2 = Print A File"
-
- by pressing key 1 or 2.
-
- If you select 1:
-
- The program will then prompt you for the left margin you want, with
- the default 0. (QuickBasic will always set labels flush left)
-
- Then answer for the desired number of spaces to use for the structure
- indent, with the default 4.
-
- Answer Y if you want the first letters of the source code
- capitalized, with the default being No. I personally find first
- capitals to be esthetically pleasing, but you should be cautious if
- your program involves matching embeded strings. QuickBasic will
- automatically set all reserved words to capitals.
-
- Answer Y if you want the program to delete empty lines.
-
- Answer Y if you want the source code to be displayed on the screen as
- it is being processed.
-
- Press the key corresponding to the drive that the source is located
- on.
-
- Select and enter the file you wish to prettify.
-
- Enter the name you wish to give the prettified source code, including
- the drive if applicable.
-
- QbPrt will then process the selected input file, and write it to the
- named output file.
-
- The processed file should then be loaded into QuickBasic and saved as
- an ASCII file if separate compilation with BC (C) is to be used. This
- will change all of the reserved words back to capitals.
-
- You will then be returned to the initial selection screen.
-
-
-
-
-
-
-
-
-
-
-
- Pg 2
-
-
-
- If you select 2:
-
- Select the drive that the source code is located on.
-
- Select and enter the file that you wish to print.
-
- Enter the title that you wish to use on the printed file.
-
- Answer where you want the processed file send. Either enter the drive
- and file name to produce a disk file, or enter PRN to send the output
- directly to the printer without saving to disk.
-
- Answer the line length that your printer will accomodate, or that you
- wish.
-
- Answer the number of lines per page that your printer will
- accomodate, or that you wish.
-
- Answer the number of columns that you want for the left margin.
-
- Answer the number of spaces that you want between the numbered lines
- delimiter and the source code.
-
- The program will then process the selected input file, and send it to
- the named destination.
-
- The disk file produced is suitable for printing on a "plain vanilla"
- dot matrix printer that prints the standard IBM/Epson character set.
- If you have a different printer, try it and see what happens.
-
- If you select 9:
-
- QbPrt will end and return to DOS.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Pg. 3
-
-
-
- Limitations:
-
- This program is intended for use with QuickBasic 4.0 or 4.5. I have
- not tried it with TurboBasic (C), and it may, or may not, work.
-
- The IF ...... THEN '(REM) comment
- .
- (ELSE, ELSEIF)
- .
- END IF
-
- structure will cause problems. Don't put a comment on the line with
- the IF ..... THEN.
-
- Don't put anything else, except comments, on lines with labels, if
- the label is embedded in a structure.
-
- If your source file contains tabs, the spacing will not come out
- correct. Certain word processors insert tabs.
-
- These are not bugs, but a decision on my part. Parsing all of the
- possible variations of labels, structures, embedded strings, and
- comments would significantly slow down the program.
-
- Labels will be flush left. Stand alone comments will be flush left.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Pg. 4
-
-
- The examples below use the same code fragment to demonstrate the
- effect of QBPRT. Note that the margin has been set full left to
- better show the output.
-
- The first is the original source code:
- ===================================================================
-
-
-
- '********************* READINBIG ************************
-
- readin:
- GET #1, , readit$
- readit$ = UCASE$(readit$)
- FOR j = 1 TO LEN(readit$)
- IF MID$(readit$, j, 1) < " " THEN MID$(readit$, j, 1) = " "
- IF MID$(readit$, j, 1) >= " " AND MID$(readit$, j, 1) < "a" THEN
- strip$ = strip$ + MID$(readit$, j, 1)
- END IF
- NEXT j
-
- SELECT CASE stripflag$
- CASE "3"
- FOR k = 1 TO LEN(strip$)
- IF NOT (MID$(strip$, k, 1) = " " AND MID$(strip$, k + 1, 1) = " ") THEN
- out$ = out$ + MID$(strip$, k, 1)
- END IF
- NEXT k
- CASE "2"
- FOR k = 1 TO LEN(strip$)
- IF MID$(strip$, k, 1) <> " " THEN
- out$ = out$ + MID$(strip$, k, 1)
- END IF
- NEXT k
- CASE "1"
- FOR k = 1 TO LEN(strip$)
- SELECT CASE MID$(strip$, k, 1)
- CASE "0"
- out$ = out$ + "ZERO"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Pg. 5
-
-
-
- The next is the source code after having been prettified.
- ===================================================================
-
-
-
- '********************* Readinbig ************************
- Readin:
- Get #1, , Readit$
- Readit$ = Ucase$(Readit$)
- For J = 1 To Len(Readit$)
- If Mid$(Readit$, J, 1) < " " Then Mid$(Readit$, J, 1) = " "
- If Mid$(Readit$, J, 1) >= " " And Mid$(Readit$, J, 1) < "A" Then
- Strip$ = Strip$ + Mid$(Readit$, J, 1)
- End If
- Next J
- Select Case Stripflag$
- Case "3"
- For K = 1 To Len(Strip$)
- If Not (Mid$(Strip$, K, 1) = " " And Mid$(Strip$, K + 1, 1) = " ") Then
- Out$ = Out$ + Mid$(Strip$, K, 1)
- End If
- Next K
- Case "2"
- For K = 1 To Len(Strip$)
- If Mid$(Strip$, K, 1) <> " " Then
- Out$ = Out$ + Mid$(Strip$, K, 1)
- End If
- Next K
- Case "1"
- For K = 1 To Len(Strip$)
- Select Case Mid$(Strip$, K, 1)
- Case "0"
- Out$ = Out$ + "Zero"
-
-
-
- Notice that the options were set for
- indent = 4
- capitalize first letters
- remove empty lines
-
- Especially note that the embedded string "ZERO" was changed to
- "Zero". Don't let this bite you!
-
-
-
-
-
-
-
-
-
-
-
-
-
- Pg. 6
-
-
-
-
- The next is the prettified file after having been reloaded into QB.
-
- ===================================================================
-
-
- '********************* Readinbig ************************
- Readin:
- GET #1, , Readit$
- Readit$ = UCASE$(Readit$)
- FOR J = 1 TO LEN(Readit$)
- IF MID$(Readit$, J, 1) < " " THEN MID$(Readit$, J, 1) = " "
- IF MID$(Readit$, J, 1) >= " " AND MID$(Readit$, J, 1) < "A" THEN
- Strip$ = Strip$ + MID$(Readit$, J, 1)
- END IF
- NEXT J
- SELECT CASE Stripflag$
- CASE "3"
- FOR K = 1 TO LEN(Strip$)
- IF NOT (MID$(Strip$, K, 1) = " " AND MID$(Strip$, K + 1, 1) = " ") THEN
- Out$ = Out$ + MID$(Strip$, K, 1)
- END IF
- NEXT K
- CASE "2"
- FOR K = 1 TO LEN(Strip$)
- IF MID$(Strip$, K, 1) <> " " THEN
- Out$ = Out$ + MID$(Strip$, K, 1)
- END IF
- NEXT K
- CASE "1"
- FOR K = 1 TO LEN(Strip$)
- SELECT CASE MID$(Strip$, K, 1)
- CASE "0"
- Out$ = Out$ + "Zero"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Pg. 7
-
-
-
-
-
- The next is an example of the output of the printing mode of the
- program. Note that the left margin was set to 0, the right margin was
- set to 79, and the space between the | and the code was set to 2.
-
- ===================================================================
-
-
-
- Fragment.Bas Page # 1
- 05-14-1989 21:48:44
- ===============================================================================
- 1 | '********************* Readinbig ************************
- 2 | Readin:
- 3 | GET #1, , Readit$
- 4 | Readit$ = UCASE$(Readit$)
- 5 | FOR J = 1 TO LEN(Readit$)
- 6 | IF MID$(Readit$, J, 1) < " " THEN MID$(Readit$, J, 1) = " "
- 7 | IF MID$(Readit$, J, 1) >= " " AND MID$(Readit$, J, 1) < "A" T»
- »HEN
- 8 | Strip$ = Strip$ + MID$(Readit$, J, 1)
- 9 | END IF
- 10 | NEXT J
- 11 | SELECT CASE Stripflag$
- 12 | CASE "3"
- 13 | FOR K = 1 TO LEN(Strip$)
- 14 | IF NOT (MID$(Strip$, K, 1) = " " AND MID$(Strip$, K +»
- » 1, 1) = " ") THEN
- 15 | Out$ = Out$ + MID$(Strip$, K, 1)
- 16 | END IF
- 17 | NEXT K
- 18 | CASE "2"
- 19 | FOR K = 1 TO LEN(Strip$)
- 20 | IF MID$(Strip$, K, 1) <> " " THEN
- 21 | Out$ = Out$ + MID$(Strip$, K, 1)
- 22 | END IF
- 23 | NEXT K
- 24 | CASE "1"
- 25 | FOR K = 1 TO LEN(Strip$)
- 26 | SELECT CASE MID$(Strip$, K, 1)
- 27 | CASE "0"
- 28 | Out$ = Out$ + "Zero"
-
-
-
- Notice that line 14, the IF NOT .... line contained in CASE "3", no
- longer runs off the right margin of the page.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ----------------end-of-author's-documentation---------------
-
- Software Library Information:
-
- This disk copy provided as a service of
-
- The Public (Software) Library
-
- We are not the authors of this program, nor are we associated
- with the author in any way other than as a distributor of the
- program in accordance with the author's terms of distribution.
-
- Please direct shareware payments and specific questions about
- this program to the author of the program, whose name appears
- elsewhere in this documentation. If you have trouble getting
- in touch with the author, we will do whatever we can to help
- you with your questions. All programs have been tested and do
- run. To report problems, please use the form that is in the
- file PROBLEM.DOC on many of our disks or in other written for-
- mat with screen printouts, if possible. The P(s)L cannot de-
- bug programs over the telephone.
-
- Disks in the P(s)L are updated monthly, so if you did not get
- this disk directly from the P(s)L, you should be aware that
- the files in this set may no longer be the current versions.
-
- For a copy of the latest monthly software library newsletter
- and a list of the 1,800+ disks in the library, call or write
-
- The Public (Software) Library
- P.O.Box 35705 - F
- Houston, TX 77235-5705
- (713) 665-7017
-